"""
Union类型，可以定义联合类型注解
"""

from typing import Union

# 代表里面有int和str类型的数据
my_list: list[Union[str,int]] = [1,2,"gaoyang","itgecan",5]

my_dict: dict[str,Union[str,int]] = {"name":"gaoyang","age":23}

# 函数类型也可用Union联合注解
def func(data: Union[str,int]) -> Union[int,str]:
    pass

